// Qt includes
#include <QApplication>
#include <QDeclarativeView>
#include <QDeclarativeEngine>
#include <QDeclarativeContext>

// Sensor Gallery includes
#include "sensormanager.h"
#include "sensormodel.h"
#include "readingvaluemodel.h"


int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QDeclarativeView view;
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    QDeclarativeEngine* engine = view.engine();

    // Connect the quit signal.
    QObject::connect(engine, SIGNAL(quit()), &app, SLOT(quit()));

    SensorManager sensorManager;

    engine->rootContext()->setContextProperty("sensorManager", &sensorManager);
    engine->rootContext()->setContextProperty("sensorModel",
                                              sensorManager.sensorModel());
    engine->rootContext()->setContextProperty("readingValueModel",
                                              sensorManager.readingValueModel());

#ifdef Q_OS_SYMBIAN
    view.setAttribute(Qt::WA_NoSystemBackground);
#endif

#ifdef Q_OS_SYMBIAN
    view.setSource(QUrl::fromLocalFile("qml/symbian/main.qml"));
#else
    view.setSource(QUrl("qrc:/main.qml"));
#endif
    view.showFullScreen();

    return app.exec();
}
